#include "../levenshtein.h"

#include <gtest/gtest.h>

using std::string;

TEST(Levenshtein, BoundaryCases)
{
    string empty = "";
    EXPECT_EQ(0, levenshtein_distance(empty, empty));

    string text = "";
    for (int i = 1; i < 10; ++i)
    {   
        text += '*';
        EXPECT_EQ(i, levenshtein_distance(empty, text));
        EXPECT_EQ(i, levenshtein_distance(text, empty));
    }
}

TEST(Levenstein, KnownCases)
{
    string str1f = "Accosinly";
    string str1s = "Occasionally";
    EXPECT_EQ(5, levenshtein_distance(str1f, str1s));

    string str2f = "Acc";
    string str2s = "Occ";
    EXPECT_EQ(1, levenshtein_distance(str2f, str2s));

    string str3f = "about";
    string str3s = "abouy";
    EXPECT_EQ(1, levenshtein_distance(str3f, str3s));

    string str4f = "alright";
    string str4s = "all right";
    EXPECT_EQ(2, levenshtein_distance(str4f, str4s));
}
